﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output method="html" indent="yes"/>
  

  <xsl:template match="/Damage">

    <HTML>
      <HEAD>
        <TITLE>ЕКСПЕРТНА ОЦЕНКА И ПОРЪЧКА</TITLE>
        <META http-equiv="content-type" content="text/html;charset=utf-8" />
        <LINK media="screen" href="styles/form.css" type="text/css" rel="stylesheet"/>
      </HEAD>
      <BODY>

        <table border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td>
              <IMG height="158" alt=""
 src="img/logo.gif" width="419" border="0"/>
            </td>
            <td>
              <P>
                ЕКСПЕРТНА ОЦЕНКА И ПОРЪЧКА
              </P>
              <P>
                N°
                <xsl:value-of select="DamageNum" disable-output-escaping="yes"/>

              </P>
              <P>ДАННИ НА КЛИЕНТА  </P>
              Име:<xsl:value-of select="Car/Owner/Name"/><br/>
              ЕИК/ЕГН:<xsl:value-of select="Car/Owner/Identifier"/><br/>
              Адрес:<xsl:value-of select="Car/Owner/CountryName"/>,<xsl:value-of select="Car/Owner/DistrictName"/>,<xsl:value-of select="Car/Owner/CityName"/>,<xsl:value-of select="Car/Owner/Address"/><br/>

            </td>
          </tr>
        </table>



        <P>
          <xsl:value-of select="OwnData"/>
        </P>
        <TABLE cellSpacing="0" cellPadding="0" width="100%" bgColor="white"
        border="0">
          <TBODY>
            <TR>
              <TD width="23%">
                <P>Дата на експертиза:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="ExpertiseDateStr"/>
                </P>
              </TD>
              <TD  width="6%"></TD>
              <TD width="23%">
                <P>Марка-модел:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="Car/MakeName"/>-<xsl:value-of select="Car/ModelName"/>
                </P>
              </TD>
            </TR>
            <TR>
              <TD width="23%">
                <P>Експерт:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="EvaluatorPerson"/>
                </P>
              </TD>
              <TD  width="6%"></TD>
              <TD width="23%">
                <P>Рег. номер:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="Car/RegNumber"/>
                </P>
              </TD>
            </TR>
            <TR>
              <TD width="23%">
                <P>Дата на експертиза:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="ExpertiseDateStr"/>
                </P>
              </TD>
              <TD  width="6%"></TD>
              <TD width="23%">
                <P>Рама:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="Car/ChassisNumber"/>
                </P>
              </TD>
            </TR>
            <TR>
              <TD width="23%">
                <P>Техник:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="TechName"/>
                </P>
              </TD>
              <TD  width="6%"></TD>
              <TD width="23%">
                <P>Полица номер:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="DocumentNumber"/>
                </P>
              </TD>
            </TR>
            <TR>
              <TD width="23%">
                <P>Тел на техник</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="TechPhone"/>
                </P>
              </TD>
              <TD  width="6%"></TD>
              <TD width="23%">
                <P>Щета номер:</P>
              </TD>
              <TD  width="4%"></TD>
              <TD  width="20%">
                <P>
                  <xsl:value-of select="DamageCode"/>
                </P>
              </TD>
            </TR>
          </TBODY>
        </TABLE>

        <TABLE  cellSpacing="0" cellPadding="0" width="100%"
        border="1">
          <TBODY>
            <TR>
              <TD  align="left">
                <P>
                  Елемент
                </P>
              </TD>
              <TD>
                <P>
                  Вдлъбнатини &lt; 20 мм
                </P>
              </TD>
              <TD>
                <P>
                  Вдлъбнатини &lt; 30 мм
                </P>
              </TD>
              <TD>
                <P>
                  Вдлъбнатини &lt; 40 мм
                </P>
              </TD>
              <TD>
                <P>
                  Вдлъбнатини &lt; 50 мм
                </P>
              </TD>
              <TD>
                <P>
                  Време за работа(минути)
                </P>
              </TD>
              <TD>
                <P>
                  С резерви
                </P>
              </TD>
              <TD>
                <P>
                  Алуминий
                </P>
              </TD>
              <TD>
                <P>
                  Сглобяване/разглобяване
                </P>
              </TD>
              <TD>
                <P>
                  Полиране
                </P>
              </TD>
              <TD>
                <P>
                  PNP
                </P>
              </TD>
              <TD>
                <P>
                  Наблюдение
                </P>
              </TD>
              <TD>
                <P>
                  Тотал
                </P>
              </TD>
            </TR>

            <xsl:for-each select="DamageDetails/DamageDetail">
              <TR>
                <TD  align="left">
                  <P>
                    <xsl:choose>
                      <xsl:when test="DetailKindId='PLK'">

                        Преден ляв калник

                      </xsl:when>

                      <xsl:when test="DetailKindId='PDK'">

                        Преден десен калник
                      </xsl:when>
                      <xsl:when test="DetailKindId='ZLK'">

                        Заден ляв калник
                      </xsl:when>
                      <xsl:when test="DetailKindId='ZDK'">

                        Заден десен калник

                      </xsl:when>
                      <xsl:when test="DetailKindId='PLV'">
                        Предна лява врата

                      </xsl:when>
                      <xsl:when test="DetailKindId='PDV'">
                        Предна дясна врата

                      </xsl:when>
                      <xsl:when test="DetailKindId='ZLV'">
                        Задна лява врата

                      </xsl:when>
                      <xsl:when test="DetailKindId='ZDV'">
                        Задна дясна врата

                      </xsl:when>
                      <xsl:when test="DetailKindId='K'">
                        Капак

                      </xsl:when>
                      <xsl:when test="DetailKindId='B'">
                        Багажник

                      </xsl:when>
                      <xsl:when test="DetailKindId='Т'">
                        Покрив

                      </xsl:when>
                      <xsl:when test="DetailKindId='LK'">
                        Лява колона

                      </xsl:when>
                      <xsl:when test="DetailKindId='DK'">

                        Дясна колона
                      </xsl:when>
                      <xsl:when test="DetailKindId='KAS'">
                        Каскет
                      </xsl:when>
                    </xsl:choose>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="Size1!=0">
                      <xsl:value-of select="Size1"/>
                    </xsl:if>

                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="Size2!=0">
                      <xsl:value-of select="Size2"/>
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="Size3!=0">
                      <xsl:value-of select="Size3"/>
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="Size4!=0">
                      <xsl:value-of select="Size4"/>
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:value-of select="Minutes"/>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="ALU='true'">
                      Да
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="WithReserve='true'">
                      Да
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="DisassemblyTime!=0">
                      <xsl:value-of select="DisassemblyTime"/>
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="Polish='true'">
                      Да
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:if test="PNPTime!=0">
                      <xsl:value-of select="PNPTime"/>
                    </xsl:if>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:value-of select="ObsStr"/>
                  </P>
                </TD>
                <TD>
                  <P>
                    <xsl:value-of select='format-number(Price, "0.00")'/>
                  </P>
                </TD>

              </TR>
            </xsl:for-each>



          </TBODY>
        </TABLE>
        <TABLE  cellSpacing="0" cellPadding="0" width="100%"
                border="0">
          <TR>
            <td>
              Допълнителни материали
            </td>
            <td>
              <xsl:value-of select='format-number(AdditionalMaterialsTotal, "0.00")'/>              
            </td>

          </TR>
          <TR>
            <td>
              Общо
            </td>
            <td>
              <xsl:value-of select='format-number(Total, "0.00")'/>
            </td>

          </TR>
          <TR>
            <td>
              Отстъпка %
            </td>
            <td>              
              <xsl:value-of select='format-number(Discount, "0.00")'/>
            </td>

          </TR>
          <TR>
            <td>
              Общо с отстъпка
            </td>
            <td>
              <xsl:value-of select='format-number(TotalDiscount, "0.00")'/>
              
            </td>

          </TR>

          <TR>
            <td>
              ДДС
            </td>
            <td>
              <xsl:value-of select='format-number(VatValue, "0.00")'/>              
            </td>

          </TR>
          <TR>
            <td>
              Крайна цена
            </td>
            <td>
              <xsl:value-of select='format-number(TotalWithVat, "0.00")'/>              
            </td>

          </TR>
        </TABLE>

      </BODY>
    </HTML>


  </xsl:template>
</xsl:stylesheet>
